import request from '@/utils/request'

/**
 * 获取物业费列表
 *
 * @param { enterpriseName, start, end, page, pageSize } params
 *
 * @returns { Promise }
 */
export function getPropertyListAPI(params) {
  return request({
    url: '/park/propertyfee',
    method: 'get',
    params
  })
}

/**
 * 获取物业费详情
 *
 * @param { String } id
 *
 * @returns { Promise }
 */
export function getPropertyDetailAPI(id) {
  return request({
    url: `/park/propertyfee/${id}`,
    method: 'get'
  })
}

/**
 * 添加物业费账单
 *
 * @param { enterpriseId, buildingId, startTime, endTime, paymentAmount, paymentMethod } data
 *
 * @returns { Promise }
 */
export function addPropertyAPI(data) {
  return request({
    url: '/park/propertyfee',
    method: 'post',
    data
  })
}

/**
 * 删除物业费账单
 *
 * @param { String } id
 *
 * @returns { Promise }
 */
export function deletePropertyAPI(id) {
  return request({
    url: `/park/propertyfee/${id}`,
    method: 'delete'
  })
}

/**
 * 查询所有企业
 *
 * @returns { Promise }
 */
export function getAllEnterpriseAPI() {
  return request({
    url: '/park/all/enterprise',
    method: 'get'
  })
}

/**
 * 查询所有楼宇
 *
 * @returns { Promise }
 */
export function getAllBuildingAPI() {
  return request({
    url: '/park/all/building',
    method: 'get'
  })
}

/**
 * 获取物业费应支付金额
 *
 * @param { buildingId, startTime, endTime } data
 *
 * @returns { Promise }
 */
export function getPropertyPayAPI(data) {
  return request({
    url: '/park/propertyfee/pre/payment',
    method: 'post',
    data
  })
}
